<?php

require "database.php";

$__victory__=(int)$_GET["victory"];
$is_yes=$_GET["is_yes"];

$__demo__=file_get_contents("demo.json");
$__demo__=json_decode($__demo__,1);


if($is_yes=="yes"){
    $__demo__["victorytop"]     =$__demo__['victorytop']+$__victory__;
}else{
    $__demo__["victorykui"]     =$__demo__['victorykui']+$__victory__;
}

$_status=0;

if($__demo__["victorytop"]>=$__demo__["victory"] || $__demo__["victorykui"]>=$__demo__["victory"]){
    $_status=1;
    $__demo__["stopsum"]+=1;
    $stopsum=$__demo__["stopsum"];
}else{
    $_status=0;
}




$__demo__=json_encode($__demo__,JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE);
file_put_contents("demo.json",$__demo__);


if($_status==1){
    return json([
        "code"=>200,
        "msg"=>"stop",
        "count"=>$stopsum
    ]);
}else{
    return json([
        "code"=>200,
        "msg"=>"continue"
    ]);
}

